import { EntitySchema } from '@mikro-orm/core';

export class TypechoAds {
  aid!: number;
  name?: string;
  type?: number = 0;
  img?: string;
  close?: number = 0;
  created?: number = 0;
  price?: number = 0;
  intro?: string;
  urltype?: number = 0;
  url?: string;
  uid?: number = -1;
  status?: number = 0;
}

export const TypechoAdsSchema = new EntitySchema({
  class: TypechoAds,
  properties: {
    aid: { primary: true, type: 'number' },
    name: { type: 'string', length: 255, nullable: true },
    type: { type: 'number', nullable: true, default: 0 },
    img: { type: 'string', length: 500, nullable: true },
    close: { type: 'number', nullable: true, default: 0 },
    created: { type: 'number', nullable: true, default: 0 },
    price: { type: 'number', nullable: true, default: 0 },
    intro: { type: 'string', length: 500, nullable: true },
    urltype: { type: 'number', nullable: true, default: 0 },
    url: { type: 'string', columnType: 'text', nullable: true },
    uid: { type: 'number', nullable: true, default: -1 },
    status: { type: 'number', nullable: true, default: 0 },
  },
});
